//
//  KColumnHorizontalView.h
//  MengLiao
//
//  Created by xiuxin on 2022/7/15.
//  Copyright © 2022 ZHBen. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "KColumnCellView.h"
#import "KColumnInfo.h"

@class KColumnHorizontalView;
@protocol KColumnHorizontalDelegate <NSObject>

- (void)horizontalView:(KColumnHorizontalView *)horizontalView willMoveToIndex:(NSInteger)toIndex fromIndex:(NSInteger)fromIndex;

- (void)horizontalView:(KColumnHorizontalView *)horizontalView didMoveToIndex:(NSInteger)toIndex fromIndex:(NSInteger)fromIndex;

@optional
- (NSInteger)numberOfColumnsInHorizontalView:(KColumnHorizontalView *)horizontalView;

- (UIView *)headerViewForHorizontalView:(KColumnHorizontalView *)horizontalView;

- (UIView<KColumnContentView> *)horizontalView:(KColumnHorizontalView *)horizontalView columnViewAtIndex:(NSInteger)index;

@end

@interface KColumnHorizontalView : UIView

@property (weak,nonatomic) NSObject<KColumnListControl> * control;

@property (readonly,strong,nonatomic) NSArray<KColumnInfo *> * columnList;

@property (readonly,nonatomic) KColumnInfo * currentColumn;

@property (readonly,nonatomic) NSInteger index;

@property (nonatomic) UIEdgeInsets displayInsets;

@property (strong,nonatomic) UIView * headerView;

@property (weak,nonatomic) id<UIScrollViewDelegate> scrollDelegate;

@property (weak,nonatomic) id<KColumnHorizontalDelegate> delegate;
///预加载 默认为NO
@property (nonatomic) BOOL preload;
///固定HeaderView 默认为NO
@property (nonatomic) BOOL fixHeader;
///允许HeaderView显示在本身的Cell外 fixHeader为YES时生效 默认为NO
@property (nonatomic) BOOL headerExistOutside;

- (void)reloadWithColumnList:(NSArray<KColumnInfo *> *)columnList headerView:(UIView *)headerView toIndex:(NSInteger)toIndex;

- (void)reload:(NSInteger)toIndex;

- (void)forceReload:(NSInteger)toIndex;

- (void)moveToIndex:(NSInteger)index animated:(BOOL)animated;

- (void)prepareColumnViewAtIndex:(NSInteger)index;

- (KDisplayPosition)displayPosition;

- (void)changeHeaderHeight:(CGFloat)headerHeight;

- (UIScrollView *)scrollView;

@end
